//
//  PurchasePictureTableViewCell.m
//  GLGW_Shoping
//
//  Created by yang on 2018/12/12.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "PurchasePictureTableViewCell.h"

@interface PurchasePictureTableViewCell ()
@property(nonatomic,strong)GLGWView * bankgroundView;
@property(nonatomic,strong)GLGWLabel * stellNameLabel;
@end

@implementation PurchasePictureTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.bankgroundView = [[GLGWView alloc] initWithInSuperView:self.contentView];
        self.bankgroundView.backgroundColor = [UIColor whiteColor];
        [self.bankgroundView setViewShadowWidth:3.0 theCornerRadius:3.0];
        [self.bankgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(self.contentView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(20));
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.bottom.equalTo(self.contentView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(20));
        }];
        //
        self.stellNameLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(16) theColor:kColor_Rule_Black inSuperView:self.bankgroundView];
        self.stellNameLabel.text = @"三级螺纹钢";
        [self.stellNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.bankgroundView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(self.bankgroundView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(19));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(22)));
        }];
        //
        for (int i=0; i<3; i++) {
            GLGWImageView * imageView = [[GLGWImageView alloc] initInSuperView:self.bankgroundView];
            imageView.backgroundColor = kRandomColor;
            
            if (i==2) {
                [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.left.equalTo(self.stellNameLabel);
                    make.right.equalTo(self.bankgroundView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
                    make.top.equalTo(self.stellNameLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(20)+kHeightProportion_In_iPhoneTriploid(207)*i);
                    make.bottom.equalTo(self.bankgroundView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(20));
                    make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(197)));
                }];
            }else{
                [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.left.equalTo(self.stellNameLabel);
                    make.right.equalTo(self.bankgroundView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
                    make.top.equalTo(self.stellNameLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(20)+kHeightProportion_In_iPhoneTriploid(207)*i);
//                    make.bottom.equalTo(self.bankgroundView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(20));
                    make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(197)));
                }];
            }
        }
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
